﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EzDesk.Attendance.AttendanceImpl.Extensions
{
    public static class DateTimeExtension
    {
        public static string FormattedDatetimeForMobile(this DateTime date)
        {
            return String.Format(
                "{0}-{1} {2}:{3}",
                date.Month.ToString(),
                date.Day.ToString(),
                date.Hour.ToString("D2"),
                date.Minute.ToString("D2")
                );
        }

        public static string FormattedDateForMobile(this DateTime date)
        {
            return String.Format(
                "{0}-{1}",
                date.Month.ToString(),
                date.Day.ToString()
                );
        }

        public static string FormattedTimeForMobile(this DateTime date)
        {
            return String.Format(
                "{0}:{1}",
                date.Hour.ToString("D2"),
                date.Minute.ToString("D2")
                );
        }

        internal static string FormattedFullDateForMobile(this DateTime date)
        {
            return String.Format(
                "{0}-{1}-{2}",
                date.Year.ToString("D4"),
                date.Month.ToString("D2"),
                date.Day.ToString("D2")
                );
        }


        internal static string FormattedTimeSpanForMobile(this TimeSpan timeSpan)
        {
            //todo: 输出漂亮的timeSpan格式
            return timeSpan.ToString();
        }
    }
}
